<!DOCTYPE html>

<html>



<head>

  <meta charset="utf-8">

  <title></title>

  <meta name="renderer" content="webkit">

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">

  <link rel="stylesheet" href="/public/static/layuiadmin/layui/css/layui.css" media="all">

  <link rel="stylesheet" href="/public/static/layuiadmin/style/admin.css" media="all">

  <style>
    .layui-form-label {
      width: 160px !important;
    }

    .layui-input-block {
      margin-left: 190px;
    }
  </style>

</head>



<body>

  <div class="layui-fluid">

    <div class="layui-card">

      <div class="layui-card-body" style="padding: 15px;">

        <form class="layui-form" method="post" lay-filter="component-form-group">

          <input type="hidden" name="id" value="{$id}">

          <div class="layui-form-item">

            <label class="layui-form-label">ユーザー名</label>

            <div class="layui-input-block">

              <input type="text" name="name" value="{$info.name}" disabled="disabled" autocomplete="off"
                class="layui-input">

            </div>

          </div>

          <div class="layui-form-item">

            <label class="layui-form-label">ログイン/ユーザー名</label>

            <div class="layui-input-block">

              <input type="text" name="username" value="{$info.username}" disabled="disabled" autocomplete="off"
                class="layui-input">

            </div>

          </div>

          <div class="layui-form-item">

            <label class="layui-form-label">元のパスワード</label>

            <div class="layui-input-inline">

              <input type="password" name="oldpassword" lay-verify="required" placeholder="元のパスワードを入力してください"
                autocomplete="off" class="layui-input">

            </div>

          </div>

          <div class="layui-form-item">

            <label class="layui-form-label">新しいパスワード</label>

            <div class="layui-input-inline">

              <input type="password" name="password" lay-verify="required" placeholder="新しいパスワードを入力してください"
                autocomplete="off" class="layui-input">

            </div>

          </div>

          <div class="layui-form-item">

            <label class="layui-form-label">新しいパスワードを確認します</label>

            <div class="layui-input-inline">

              <input type="password" name="newpassword" lay-verify="required" placeholder="新しいパスワードを確認するために入力してください"
                autocomplete="off" class="layui-input">

            </div>

          </div>

          <div class="layui-form-item layui-layout-admin">

            <div class="layui-input-block">

              <div class="layui-footer" style="left: 0;">

                <button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">保存</button>

              </div>

            </div>

          </div>

        </form>

      </div>

    </div>

  </div>

  <script src="/public/static/layuiadmin/layui/layui.js"></script>

  <script>

    layui.config({

      base: '/public/static/layuiadmin/' // 静态资源所在路径

    }).extend({

      index: 'lib/index', // 主入口模块

      api: 'api'

    }).use(['index', 'form', 'laydate', 'api'], function () {

      var $ = layui.$,

        admin = layui.admin,

        element = layui.element,

        layer = layui.layer,

        laydate = layui.laydate,

        api = layui.api,

        form = layui.form;



      form.render(null, 'component-form-group');



      /* 监听提交 */

      form.on('submit(component-form-demo1)', function (data) {

        var dats = data.field;

        var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引

        if (dats.oldpassword == dats.password) {

          layer.msg("新しいパスワードを元のパスワードと同じにすることはできません。");

          return false;

        }

        if (dats.password != dats.newpassword) {

          layer.msg("2 回入力した新しいパスワードは一致しません。");

          return false;

        }

        layer.msg('読み込み中', {

          icon: 16,

          shade: 0.01

        });

        api.ajax('{:url("passwordfun")}', 'post', 'json', dats, function (res) {

          layer.closeAll('loading');

          layer.msg(res.msg);

          if (res.code == 0) {

            setTimeout(function () {

              top.location.href = "{:url('Login/index')}";

            }, 1000)

          }

        });

        return false;

      });

    });

  </script>

</body>



</html>